using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;

namespace NhaThuocOnline.Entities.Mapping
{
    public class BenhNhanMap : EntityTypeConfiguration<BenhNhan>
    {
        public BenhNhanMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.Id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.HoTen)
                .HasMaxLength(100);

            this.Property(t => t.Tuoi)
                .HasMaxLength(3);

            this.Property(t => t.Phone)
                .HasMaxLength(20);

            // Table & Column Mappings
            this.ToTable("BenhNhan");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.HoTen).HasColumnName("HoTen");
            this.Property(t => t.Tuoi).HasColumnName("Tuoi");
            this.Property(t => t.GioiTinh).HasColumnName("GioiTinh");
            this.Property(t => t.Phone).HasColumnName("Phone");
        }
    }
}
